package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.VersionManagement;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/VersionManagementMapper.class */
public interface VersionManagementMapper {
    @Results(id = "map", value = {@Result(property = "createTime", column = "create_time"), @Result(property = "updateTime", column = "update_time"), @Result(property = "editionNum", column = "edition_num"), @Result(property = "releaseStatus", column = "release_status")})
    @Select({"select *  from  version_management where id = #{id}"})
    VersionManagement queryById(Integer num);

    @ResultMap({"map"})
    @Select({"select * from  version_management where release_status = 1 and edition_num = (select max(edition_num) from  version_management )   order by id desc "})
    VersionManagement queryByIdDesc();

    @Select({"select count(*) from  version_management where edition_num = #{editionNum}"})
    Integer queryByEditionNum(Integer num);

    @Select({"select max(edition_num) from  version_management"})
    Integer queryMaxEditionNum();

    @ResultMap({"map"})
    @Select({"<script>select *  from version_management <where> <if test='edition != null and edition.length &gt; 0'>edition=#{edition} </if><if test='releaseStatus != null'> and release_status=#{releaseStatus} </if><if test='createTime != null and createTime.length &gt; 0'>and create_time=#{createTime} </if><if test='updateTime != null and updateTime.length &gt; 0'>and update_time=#{updateTime} </if><if test='editionNum != null '>and edition_num=#{editionNum} </if></where> </script>"})
    List<VersionManagement> queryAll(VersionManagement versionManagement);

    @Insert({"insert into version_management(edition,create_time,url,edition_num) values(#{edition},#{createTime},#{url},#{editionNum})"})
    int insert(VersionManagement versionManagement);

    @Update({"<script>update version_management <set><if test='edition != null and edition.length &gt; 0'>edition=#{edition},</if><if test='releaseStatus != null '>  release_status=#{releaseStatus}, </if><if test='createTime != null and createTime.length &gt; 0'> create_time=#{createTime}, </if><if test='updateTime != null and updateTime.length &gt; 0'> update_time=#{updateTime}, </if><if test='url != null and url.length &gt; 0'> url=#{url}, </if><if test='editionNum != null '> edition_num=#{editionNum} </if></set>where id = #{id}</script>"})
    int update(VersionManagement versionManagement);

    @Delete({"delete from version_management where id = #{id}"})
    int deleteById(Integer num);

    @Update({"<script>update version_management set url=#{url} where id = #{id}</script>"})
    int updateUrl(VersionManagement versionManagement);
}